package com.woniuxy.cloud52.order.common;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

/**
 *
 * Feign拦截器
 */
@Component
@Slf4j
public class AddHeaderFeignRequestInterceptor implements RequestInterceptor {

    @Value("${spring.application.name}")
    private String appName;

    @Override
    public void apply(RequestTemplate template) {
        log.info("发送请求：{}",template.url());
        template.header("from",appName);
    }
}
